/*
J 4
I will not stop going to AK,
although I will never AK.
--  GD-00114  dengziyue  Xintang NO.3 Middle School
--  Writed at 11:15
*/
#include<cstdio>
using namespace std;
#define max_n 200020
int n;
int a[max_n+2];
int l[max_n+2];
int r[max_n+2];
int ans[max_n+2];
int ansi;
int main(){
	freopen("fruit.in","r",stdin);
	freopen("fruit.out","w",stdout);
	scanf("%d",&n);
	a[0]=-1;
	l[n+1]=n;
	r[0]=1;
	for(int i=1;i<=n;++i){
		scanf("%d",a+i);
		l[i]=i-1;
		r[i]=i+1;
	}
	while(r[0]<=n){
		ansi=0;
		for(int i=r[0];i!=n+1;i=r[i]){
			if(a[i]!=a[l[i]])ans[++ansi]=i;
		}
		for(int i=1;i<=ansi;++i){
			r[l[ans[i]]]=r[ans[i]];
			l[r[ans[i]]]=l[ans[i]];
			printf("%d",ans[i]);
			if(i<ansi)printf(" ");
		}
		printf("\n");
	}
	return 0;
}

